/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jBeatsSongReviews.java
 *
 * Created on Nov 11, 2012, 5:21:59 PM
 */
package cs341.cs.uwosh.edu.jBeats;

/**
 *
 * @author haibut41
 */
public class jBeatsSongReviews extends javax.swing.JFrame {

    /** Creates new form jBeatsSongReviews */
    public jBeatsSongReviews(Song song) {
        initComponents();
        songNameLabel.setText(song.getName());
        ratingLabel.setText(""+song.getRating());
        String[] reviews = DatabaseInfo.getSongReviews(song.getName());
        for (String review : reviews){
            songReviewTextArea.append(review+"\n\n");
        }
        
    }

    private jBeatsSongReviews() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        songReviewsPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        reviewLabel = new javax.swing.JLabel();
        songNameLabel = new javax.swing.JLabel();
        staticRatingLabel = new javax.swing.JLabel();
        static5Label = new javax.swing.JLabel();
        ratingLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        songReviewTextArea = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        songReviewsPanel.setBackground(new java.awt.Color(84, 131, 161));
        songReviewsPanel.setName("songReviewsPanel"); // NOI18N

        jPanel1.setBackground(new java.awt.Color(84, 116, 191));
        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(376, 100));

        reviewLabel.setText("Rating for:");
        reviewLabel.setName("reviewLabel"); // NOI18N

        songNameLabel.setText("Song name");
        songNameLabel.setName("songNameLabel"); // NOI18N

        staticRatingLabel.setText("Your Rating:");
        staticRatingLabel.setName("staticRatingLabel"); // NOI18N

        static5Label.setText("/ 5.0");
        static5Label.setName("static5Label"); // NOI18N

        ratingLabel.setText("5.0");
        ratingLabel.setName("ratingLabel"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(reviewLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                        .addComponent(songNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 348, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(staticRatingLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(ratingLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(static5Label)
                        .addContainerGap(294, Short.MAX_VALUE))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(reviewLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(songNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(staticRatingLabel)
                    .addComponent(ratingLabel)
                    .addComponent(static5Label))
                .addGap(16, 16, 16))
        );

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        songReviewTextArea.setColumns(20);
        songReviewTextArea.setEditable(false);
        songReviewTextArea.setLineWrap(true);
        songReviewTextArea.setRows(5);
        songReviewTextArea.setWrapStyleWord(true);
        songReviewTextArea.setName("songReviewTextArea"); // NOI18N
        jScrollPane1.setViewportView(songReviewTextArea);

        javax.swing.GroupLayout songReviewsPanelLayout = new javax.swing.GroupLayout(songReviewsPanel);
        songReviewsPanel.setLayout(songReviewsPanelLayout);
        songReviewsPanelLayout.setHorizontalGroup(
            songReviewsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, songReviewsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(songReviewsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE))
                .addContainerGap())
        );
        songReviewsPanelLayout.setVerticalGroup(
            songReviewsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(songReviewsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
                .addGap(22, 22, 22))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(songReviewsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(songReviewsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(jBeatsSongReviews.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(jBeatsSongReviews.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(jBeatsSongReviews.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(jBeatsSongReviews.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new jBeatsSongReviews().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel ratingLabel;
    private javax.swing.JLabel reviewLabel;
    private javax.swing.JLabel songNameLabel;
    private javax.swing.JTextArea songReviewTextArea;
    private javax.swing.JPanel songReviewsPanel;
    private javax.swing.JLabel static5Label;
    private javax.swing.JLabel staticRatingLabel;
    // End of variables declaration//GEN-END:variables
}
